<template>
	<view>
		<view class="user-container" v-show="!sign">
			<view class="user-box">
				<view class="head"></view>
				<div class="user-avatar flex-x-around-center">
					<image class="" :src="avaUrl"></image>
				</div>
				<h-card br="0" padding="0 20rpx" margin="0 0 30rpx 0">
					<view class="user-info">
						<view class="item-row flex-x-start-center">
							<image src="@/static/image/user/user.png"></image>
							<text>姓名</text>
							<view class="flex-grow-1"></view>
							<text>{{userInfo.username}}</text>
						</view>
						<view class="item-row  flex-x-start-center">
							<image src="@/static/image/user/phone.png"></image>
							<text>手机号</text>
							<view class="flex-grow-1"></view>
							<text>{{userInfo.simCard}}</text>
						</view>
					</view>
				</h-card>
			</view>
			<!--<button type="primary" class="sign-btn" @click="uploadSign">上传电子签名</button>-->
			<button type="default" class="logout-btn" @click="logout">退出登录</button>
			<!-- <h-tarbar></h-tarbar> -->
		</view>
		<view v-show="sign">
			<sin-signature ref="sig" v-model="signature" @back="backUser"></sin-signature>
		</view>
	</view>
</template>

<script>
import ava from '@/static/image/user/user1.png'
	export default {
		data() {
			return {
				sign: false,
			    signature:'',
				avaUrl:''||ava,
			};
		},

		// onLoad() {
		// 	uni.hideTabBar()
		// },
		async onShow() {
            let _ = this
			console.log(_.wxUserInfo.avatarUrl)
			_.avaUrl = _.wxUserInfo.avatarUrl
			_.getUserData()
		},
		methods: {
			async getUserData(){
				let _ = this
			},
			uploadSign(){
				let _ = this
				_.sign = true
			},
			backUser(val){
				let _ = this
				_.sign = val
			},
			logout(){
				let _ = this
				_.$T.showModal('是否确定退出登录',()=>{
                    _.$u.vuex('token', '');
                    _.$u.vuex('userInfo', {});
                    _.$u.vuex('wxUserInfo', {});
				    //
                    uni.setStorageSync('logout','1')
				    uni.removeStorageSync('Authorization')
                    uni.reLaunch({url:'/pages/login/index'})
				})
			}
		}
	}
</script>

<style lang="scss">
@import 'index.scss';
</style>
